package com.lhnstart.learn.bases.onedimensional;

/**
 * 数组反转
 *
 * @author lhn
 * @date 2022/10/30 11:14
 * @since 1.0.0
 **/
public class ArrayReverse {

    public static void main(String[] args) {
        int[] arrays = {11, 22, 33, 44, 55, 66, 77};
        int arrays2[] = new int[7];

        for (int i = arrays.length; i > 0; i--) {
            arrays2[i - arrays.length] = arrays[i];
        }
        for (int i = 0; i < arrays2.length; i++) {
            System.out.println(arrays2[i]);
        }
    }

    private static void extracted(int[] arrays) {
        for (int i = 0; i < arrays.length / 2; i++) {
            int sourceNumber = arrays[arrays.length - 1 - i];
            arrays[arrays.length - 1 - i] = arrays[i];
            arrays[i] = sourceNumber;
        }
        for (int i = 0; i < arrays.length; i++) {
            System.out.println(arrays[i]);
        }
    }

}